<?php
/**
 * Created by PhpStorm.
 * User: DongYao
 * Date: 2017/12/26
 * Time: 下午3:18
 */

namespace App\Listeners;


use App\Events\DeviceStatusChange;
use App\Tables\Device;

use Log;
class WebAppOrderChangeListener
{
    /**
     * Create the event listener.
     *
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  Event  $event
     * @return void
     */
    public function handle($event)
    {
        $device = Device::where('device_sn', $event->order->device_sn)->first();
        if (!empty($device)) {
            event(new DeviceStatusChange($device));
        }
    }
}